<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>head</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua" crossorigin="anonymous"></script>
        <%
            String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
            session.setAttribute("basePath",basePath);
       %>
    <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
    <base href=<%=basePath%>
</head>

<body>
<%
    if(request.getAttribute("account")!=null) session.setAttribute("account",request.getAttribute("account"));
%>

<nav class="navbar navbar-expand-lg navbar-light bg-light" style="background: aliceblue">
    <a class="navbar-brand" href="client/bookServlet?action=SelectBookBySales">Only __ book</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarText">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link" href="./client/bookServlet?action=PageByPageNo&Page=1"> 首页 <span class="sr-only">(current)</span></a>
            </li>
        </ul>

        <ul class="nav justify-content-end">
            <c:if test="${empty sessionScope.User}">
                <li class="nav-item">
                    <a class="nav-link active" href="./html/Login.jsp">
                        登录
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="./html/UserRegistration.jsp">注册</a>
                </li>
            </c:if>

            <li class="nav-item">
                <a class="nav-link" href="./html/Cart.jsp">购物车</a>
            </li>
            <c:if test="${not empty sessionScope.User}">
                <li class="nav-item">
                    <a class="nav-link active" href="./orderServlet?action=SelectMyOrderByUserid&user_id=${sessionScope.User.id}">我的订单</a>
                </li>
            </c:if>
            <li class="nav-item">
                <a class="nav-link" href="./manage/head.jsp">后台管理</a>
            </li>
            <li class="nav-item">
                <a class="nav-link disabled"></a>
            </li>

            <c:if test="${not empty sessionScope.User}">
                <li class="nav-item">
                    <a class="nav-link active" href="./html/Email.jsp">邮箱绑定/更换</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="./userServlet?hidden=Logout">注销</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link disabled" href="./html/UserRegistration.jsp"><font color="red">${sessionScope.User.username}</font></a>
                </li>
            </c:if>

        </ul>
    </div>

</nav>
</body>
</html>
